package com.ph.pojo;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;

import java.io.Serializable;
import java.sql.Timestamp;
import java.util.List;

@Data
@TableName("keep_plan")
public class KeepPlan implements Serializable {
    private static final long serialVersionUID = -3756194762174622828L;
    @TableId(type = IdType.AUTO)
    private Long id;
    private String name;
    private Integer year;
    private String level;
    private String method;
    private String keepDate;
    private Integer overDay;
    private Integer skipDay;
    private String remark;
    private String status;
    private Integer createId;
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Timestamp createTime;

    @TableField(exist = false)
    List<KeepProject> keepProjects;
    @TableField(exist = false)
    private String createName;

    public Long getId() {
//        时间 + id
        if (createTime != null){
            id =  Long.valueOf(createTime.toString().replace("-", "").replace(" ", "").replace(":", "").replace(".", "") + id);
        }
        return id;
    }
}
